package net.zjitc.stack;

import java.util.LinkedList;
import java.util.List;

public class MyLinkedStack<T> implements MyStack<T> {
    //last--?顶
    LinkedList<T> list = new LinkedList<T>();
    @Override
    public boolean isEmpty() {
        return list.isEmpty();
    }

    @Override
    public T peek() {
        return list.getLast();
    }

    @Override
    public T pop() {
        return list.removeLast();
    }

    @Override
    public void push(T e) {
         list.addLast(e);
    }
}
